#include "Common.h"
#include "ConcurrentAlloc.h"

void Alloc1()
{
	for (int i = 1;i <= 5;i++)
	{
		void* ptr = ConcurrentAlloc(6);
	}
}

void Alloc2()
{
	for (int i = 1;i <= 5;i++)
	{
		void* ptr = ConcurrentAlloc(7);
	}
}

void testTLS()
{
	std::thread t1(Alloc1);
	std::thread t2(Alloc2);
	t1.join();
	t2.join();
}

void test1()
{
	void* p1 = ConcurrentAlloc(6);
	void* p2 = ConcurrentAlloc(6);
	void* p3 = ConcurrentAlloc(6);
	void* p4 = ConcurrentAlloc(6);
	void* p5 = ConcurrentAlloc(6);
	void* p6 = ConcurrentAlloc(6);
	void* p7 = ConcurrentAlloc(6);


	ConcurrentFree(p1, 6);
	ConcurrentFree(p2, 6);
	ConcurrentFree(p3, 6);
	ConcurrentFree(p4, 6);
	ConcurrentFree(p5, 6);
	ConcurrentFree(p6, 6);
	ConcurrentFree(p7, 6);
}

int main()
{
	//testTLS();
	test1();
	return 0;
}